package vip.source.pattern.part15.iterator;

import java.util.ArrayList;
import java.util.List;

/**
 * 书籍集合
 */
class BookCollection implements Aggregate {
    private List<Book> books = new ArrayList<>();

    public void addBook(Book book) {
        books.add(book);
    }

    @Override
    public Iterator iterator() {
        return new BookIterator(books);
    }
}
